The 2nd character in a string is at index 1.
def combine2(s1, s2):
s3 = s1[1]
s4 = s2[1]
result = s3 + s4
return result
Function Call | Return Value | |||
---|---|---|---|---|
combine2('Car', 'wash') | → | |||
combine2(' Hello', ' world') | → | |||
combine2('55', '88') | → | |||
combine2('Snow', 'ball') | → | |||
combine2('Rain', 'boots') | → | |||
combine2('Reading', 'bat') | → | |||
combine2('AA', 'HI') | → | |||
combine2('Hi', 'there') | → | |||
combine2(' ', ' ') | → |
Experiment with this code on Gitpod.io